﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Caching;

namespace WeiSha.Core
{
	// Token: 0x0200002E RID: 46
	public class PlateOrganInfo
	{
		// Token: 0x1700009B RID: 155
		// (get) Token: 0x060001A4 RID: 420 RVA: 0x0000BF25 File Offset: 0x0000A125
		// (set) Token: 0x060001A5 RID: 421 RVA: 0x0000BF2D File Offset: 0x0000A12D
		public string Domain { get; set; }

		// Token: 0x1700009C RID: 156
		// (get) Token: 0x060001A6 RID: 422 RVA: 0x0000BF36 File Offset: 0x0000A136
		// (set) Token: 0x060001A7 RID: 423 RVA: 0x0000BF3E File Offset: 0x0000A13E
		public string WebTemplateName { get; set; }

		// Token: 0x1700009D RID: 157
		// (get) Token: 0x060001A8 RID: 424 RVA: 0x0000BF47 File Offset: 0x0000A147
		// (set) Token: 0x060001A9 RID: 425 RVA: 0x0000BF4F File Offset: 0x0000A14F
		public string MobiTemplateName { get; set; }

		// Token: 0x1700009E RID: 158
		// (get) Token: 0x060001AA RID: 426 RVA: 0x0000BF58 File Offset: 0x0000A158
		// (set) Token: 0x060001AB RID: 427 RVA: 0x0000BF60 File Offset: 0x0000A160
		public bool IsDefault { get; set; }

		// Token: 0x1700009F RID: 159
		// (get) Token: 0x060001AC RID: 428 RVA: 0x0000BF69 File Offset: 0x0000A169
		// (set) Token: 0x060001AD RID: 429 RVA: 0x0000BF71 File Offset: 0x0000A171
		public bool IsRoot { get; set; }

		// Token: 0x170000A0 RID: 160
		// (get) Token: 0x060001AE RID: 430 RVA: 0x0000BF7A File Offset: 0x0000A17A
		// (set) Token: 0x060001AF RID: 431 RVA: 0x0000BF82 File Offset: 0x0000A182
		public string Org_ExtraWeb { get; set; }

		// Token: 0x170000A1 RID: 161
		// (get) Token: 0x060001B0 RID: 432 RVA: 0x0000BF8B File Offset: 0x0000A18B
		// (set) Token: 0x060001B1 RID: 433 RVA: 0x0000BF93 File Offset: 0x0000A193
		public string Org_ExtraMobi { get; set; }

		// Token: 0x170000A2 RID: 162
		// (get) Token: 0x060001B2 RID: 434 RVA: 0x0000BF9C File Offset: 0x0000A19C
		public static bool IsInitialization
		{
			get
			{
				return PlateOrganInfo._organinfo != null;
			}
		}

		// Token: 0x170000A3 RID: 163
		// (get) Token: 0x060001B3 RID: 435 RVA: 0x0000BFB8 File Offset: 0x0000A1B8
		public static string Version
		{
			get
			{
				bool flag = string.IsNullOrWhiteSpace(PlateOrganInfo._version);
				if (flag)
				{
					PlateOrganInfo._version = Request.Version;
				}
				return PlateOrganInfo._version;
			}
		}

		// Token: 0x060001B4 RID: 436 RVA: 0x0000BFEC File Offset: 0x0000A1EC
		public static void Clear()
		{
			PlateOrganInfo._organinfo = null;
			Cache cache = HttpRuntime.Cache;
			IDictionaryEnumerator enumerator = cache.GetEnumerator();
			ArrayList arrayList = new ArrayList();
			while (enumerator.MoveNext())
			{
				arrayList.Add(enumerator.Key);
			}
			foreach (object obj in arrayList)
			{
				string text = (string)obj;
				bool flag = text.StartsWith("WEISHAKEJI_TEMPLATE_DOCUMENT");
				if (flag)
				{
					cache.Remove(text);
				}
			}
		}

		// Token: 0x060001B5 RID: 437 RVA: 0x0000C098 File Offset: 0x0000A298
		public static void Add(PlateOrganInfo info)
		{
			object obj = PlateOrganInfo._obj;
			lock (obj)
			{
				bool flag2 = PlateOrganInfo._organinfo == null;
				if (flag2)
				{
					PlateOrganInfo._organinfo = new List<PlateOrganInfo>();
				}
				PlateOrganInfo._organinfo.Add(info);
			}
		}

		// Token: 0x060001B6 RID: 438 RVA: 0x0000C0F8 File Offset: 0x0000A2F8
		public static PlateOrganInfo Current()
		{
			bool flag = PlateOrganInfo._organinfo == null;
			PlateOrganInfo plateOrganInfo;
			if (flag)
			{
				plateOrganInfo = null;
			}
			else
			{
				string twoDomain = Request.Domain.TwoDomain;
				PlateOrganInfo plateOrganInfo2 = null;
				foreach (PlateOrganInfo plateOrganInfo3 in PlateOrganInfo._organinfo)
				{
					bool flag2 = twoDomain.Equals(plateOrganInfo3.Domain, StringComparison.CurrentCultureIgnoreCase);
					if (flag2)
					{
						plateOrganInfo2 = plateOrganInfo3;
						break;
					}
				}
				bool flag3 = plateOrganInfo2 == null;
				if (flag3)
				{
					foreach (PlateOrganInfo plateOrganInfo4 in PlateOrganInfo._organinfo)
					{
						bool isDefault = plateOrganInfo4.IsDefault;
						if (isDefault)
						{
							plateOrganInfo2 = plateOrganInfo4;
							break;
						}
					}
				}
				bool flag4 = plateOrganInfo2 == null;
				if (flag4)
				{
					foreach (PlateOrganInfo plateOrganInfo5 in PlateOrganInfo._organinfo)
					{
						bool isRoot = plateOrganInfo5.IsRoot;
						if (isRoot)
						{
							plateOrganInfo2 = plateOrganInfo5;
							break;
						}
					}
				}
				plateOrganInfo = plateOrganInfo2;
			}
			return plateOrganInfo;
		}

		// Token: 0x0400007F RID: 127
		private static string _version;

		// Token: 0x04000080 RID: 128
		private static List<PlateOrganInfo> _organinfo = null;

		// Token: 0x04000081 RID: 129
		private static object _obj = new object();
	}
}
